# 计算日期范围内的所有日期

import datetime


def get_date_range(start_date, end_date):
    date_range = []
    while start_date <= end_date:
        date_range.append(start_date)
        # 将日期字符串格式化成指定格式的、日期对象
        start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d')
        date_ca = datetime.timedelta(days=1)
        start_date += date_ca
        # 将日期对象格式化为指定格式的日期字符串
        start_date = start_date.strftime('%Y-%m-%d')

    return date_range


start_time = "2024-05-28"
end_time = "2024-06-02"
date_list = get_date_range(start_time, end_time)
print(date_list)
